#ifndef	__gui_h__
#define	__gui_h__

#define	NOMINMAX
#define	WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "math/MathLib.h"

class Image;
class Scene;
class CudaTracer;

class GUI
{
public:
	static	GUI&	Instance(void);
	// glut callbacks
	static	void	DisplayCallback(void);
	static	void	ResizeCallback(int width, int height);
	static	void	KeyboardCallback(uint8 key, int x, int y);
	static	void	MouseCallback(int button, int state, int x, int y);
	static	void	MotionCallback(int x, int y);

protected:
	GUI();
	~GUI();

public:
	bool			Create(int wndWidth, int wndHeight, const rtString& caption);
	int				Run(Scene& scene);

private:
	void			RecreateTexture(void);
	void			Display(void);
	void			Resize(int width, int height);
	void			Keyboard(uint8 key, int x, int y);
	void			Mouse(int button, int state, int x, int y);
	void			Motion(int x, int y);

private:
	Image*			m_Screen;
	Scene*			m_Scene;
	CudaTracer*		m_Tracer;
	int				m_WindowWidth;
	int				m_WindowHeight;
	int				m_TextureWidth;
	int				m_TextureHeight;
	int				m_GLTexture;
	rtMath::vec2	m_MouseCaptured;
};

#endif	// __gui_h__
